<?php
// $Id$

/**
 * @file
 * Interface between mewdkp_styles.module and views.module.
 */

/**
 * Implementation of hook_views_handlers()
 */
function mewdkp_styles_views_handlers() {
  return array(
    'info' => array(
      'path' => drupal_get_path('module', 'mewdkp') .'/includes',
    ),
    'handlers' => array(
      'mewdkp_handler_field_content_player' => array(
        'parent' => 'content_handler_field',
      ),
			'mewdkp_handler_field_content_class' => array(
				'parent' => 'views_handler_field'
			),			
			'mewdkp_handler_field_content_race' => array(
				'parent' => 'views_handler_field'
			),
			'mewdkp_handler_field_content_icon' => array(
				'parent' => 'views_handler_field'
			),
			'mewdkp_handler_field_content_player_active' => array(
				'parent' => 'views_handler_field'
			),
			'mewdkp_handler_field_content_player_name' => array(
				'parent' => 'views_handler_field_node'
			),
			'mewdkp_handler_field_content_dkp' => array(
				'parent' => 'views_handler_field_numeric'
			),
    )
  );
}
 
function mewdkp_styles_views_data_alter(&$data) {

  //We will hook into the data and replace with rewritten field handlers.
	if (variable_get('mewdkp_use_class_colors', TRUE)) {
		$data['node_data_field_mewdkp_player']['field_mewdkp_player_nid']['field']['handler'] = 'mewdkp_handler_field_content_player';
		$data['node_data_field_mewdkp_player_name']['field_mewdkp_player_name_value']['field']['handler'] = 'mewdkp_handler_field_content_player_name';
	}
	if (variable_get('mewdkp_use_dkp_colors', TRUE)) {
		$data['node_data_field_mewdkp_dkp_spent']['field_mewdkp_dkp_spent_value']['field']['handler'] = 'mewdkp_handler_field_content_dkp';
		$data['node_data_field_mewdkp_dkp_current']['field_mewdkp_dkp_current_value']['field']['handler'] = 'mewdkp_handler_field_content_dkp';
		$data['node_data_field_mewdkp_dkp_earned']['field_mewdkp_dkp_earned_value']['field']['handler'] = 'mewdkp_handler_field_content_dkp';
	}
	
	$data['node_data_field_mewdkp_class']['field_mewdkp_class_value']['field']['handler'] = 'mewdkp_handler_field_content_class';
	$data['node_data_field_mewdkp_race']['field_mewdkp_race_value']['field']['handler'] = 'mewdkp_handler_field_content_race';
	$data['node_data_field_mewdkp_icon']['field_mewdkp_icon_value']['field']['handler'] = 'mewdkp_handler_field_content_icon';
	$data['node_data_field_mewdkp_player_active']['field_mewdkp_player_active_value']['field']['handler'] = 'mewdkp_handler_field_content_player_active';
	
  //dpm($data);
} 